<?php
/**
 * Created by PhpStorm
 * User: whh
 * Date: 2023/8/21
 * Time: 22:17
 */

namespace app\common\model;


use think\Model;
use think\model\concern\SoftDelete;

class RechargeItem extends Model
{
    use Common;

    protected $table = 'pay_recharge_item';
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;


    public static function defaultTemplate($quickId){
        return [
            [
                'quick_id' => $quickId,
                'total_fee' => 2800,
                'virtual_currency' => 2800,
                'vipdays' => 0,
                'point_gift' => 1000,
                'selected' => 0,
                'lable' => '限时优惠',
                'lable_open' => 1,
            ],
            [
                'quick_id' => $quickId,
                'total_fee' => 5000,
                'virtual_currency' => 5000,
                'vipdays' => 0,
                'point_gift' => 3000,
                'selected' => 1,
                'lable' => '热门',
                'lable_open' => 1,
            ],
            [
                'quick_id' => $quickId,
                'total_fee' => 1800,
                'virtual_currency' => 1800,
                'vipdays' => 0,
                'point_gift' => 0,
                'selected' => 0,
                'lable' => '',
                'lable_open' => 0,
            ], [
                'quick_id' => $quickId,
                'total_fee' => 7000,
                'virtual_currency' => 7000,
                'vipdays' => 0,
                'point_gift' => 4000,
                'selected' => 0,
                'lable' => '限时优惠',
                'lable_open' => 1,
            ], [
                'quick_id' => $quickId,
                'total_fee' => 10000,
                'virtual_currency' => 1000,
                'vipdays' => 0,
                'point_gift' => 7000,
                'selected' => 0,
                'lable' => '',
                'lable_open' => 0,
            ], [
                'quick_id' => $quickId,
                'total_fee' => 19900,
                'virtual_currency' => 19900,
                'vipdays' => 0,
                'point_gift' => 20000,
                'selected' => 0,
                'lable' => '翻倍优惠',
                'lable_open' => 1,
            ], [
                'quick_id' => $quickId,
                'total_fee' => 39900,
                'virtual_currency' => 0,
                'vipdays' => 365,
                'point_gift' => 0,
                'selected' => 0,
                'lable' => '',
                'lable_open' => 0,
            ]
        ];
    }

    public function getTotalFeeTextAttr($value,$data)
    {
        return $data['total_fee'] / 100;
    }
}